<template>
  <div>
    <el-table
        ref="filterTable"
        :data="tableData"
        border
        style="width: 100%">
      <el-table-column
          type="index"
          label="分数编号"
          width="180">
      </el-table-column>
      <el-table-column
          prop="examVo.ename"
          label="考试科目"
          width="180">
      </el-table-column>
      <el-table-column
          prop="user.username"
          label="考试人"
          width="180">
      </el-table-column>
      <el-table-column
          prop="score"
          label="分数"
          width="180">
      </el-table-column>
      <el-table-column
          prop="etime"
          label="结束时间"
          width="180">
      </el-table-column>

      <el-table-column>
        <template slot-scope="scope">
          <el-button type="primary" @click="ck(scope.row)">查看错题</el-button>
        </template>
      </el-table-column>

    </el-table>
  </div>
</template>

<script>
import {getRequest} from "@/utils/api";

export default {
  name: "Sscore",
  data(){
    return{
      tableData:[],
      stuan:{},
      user:{}
    }
  },
  methods:{
    ck(obj){
      this.stuan.uid=obj.uid
      this.stuan.etime=obj.etime
      window.sessionStorage.setItem("stuan",JSON.stringify(this.stuan))
      this.$router.push("/sstuan")
    },
    findAll(){
      this.user=JSON.parse(window.sessionStorage.getItem("user"))
      getRequest("/question/scores?uid="+this.user.uid).then(resp =>{
        this.tableData=resp.data.data;
      })
    },
  },
  created() {
    this.findAll()
  }
}
</script>

<style scoped>

</style>